package com.navinfo.platform.bean;


import com.navinfo.platform.util.EntityConvert;

import com.navinfo.opentsp.platform.location.protocol.common.LCPredictiveMaintenanceD00B;

public class MaintenanceEvent2D00BDto {
    private   int      blockSwitch            ;      // 滤芯堵塞报警通断
    private  double    difPressure            ;      // 发动机空滤压差
    private   int      frontEBS               ;      // 前桥制动气室气压
    private   int      backEBS                ;      //后桥制动气室气压
    private  double    frontLeftHoofStatusEBS ;      // 前轴左轮-蹄片状态EBS。百分数、可能是小数
    private  double    frontRightHoofStatusEBS;      //  前轴右轮-蹄片状态EBS
    private  double    back1LeftHoofStatusEBS ;      // 后一左轮-蹄片状态EBS
    private  double    back1RightHoofStatusEBS;      //  后一右轮-蹄片状态EBS
    private  double    back2LeftHoofStatusEBS ;      // 后二左轮-蹄片状态EBS
    private  double    back2RightHoofStatusEBS;      //  后二右轮-蹄片状态EBS
    private  double    back3LeftHoofStatusEBS ;      // 后三左轮-蹄片状态EBS
    private  double    back3RightHoofStatusEBS;      //  后三右轮-蹄片状态EBS
    private   int      frontLeftHoofStatus    ;      //前轴左轮-蹄片状态。0-3共4个状态
    private   int      frontRightHoofStatus   ;      // 前轴右轮-蹄片状态
    private   int      back1LeftHoofStatus    ;      //后一左轮-蹄片状态
    private   int      back1RightHoofStatus;      // 后一右轮-蹄片状态
    private   int      back2LeftHoofStatus;      //后二左轮-蹄片状态
    private   int      back2RightHoofStatus   ;      // 后二右轮-蹄片状态
    private   int      back3LeftHoofStatus    ;      //后三左轮-蹄片状态
    private   int      back3RightHoofStatus   ;      // 后三右轮-蹄片状态


    public int getBlockSwitch() {
        return blockSwitch;
    }

    public void setBlockSwitch(int blockSwitch) {
        this.blockSwitch = blockSwitch;
    }

    public double getDifPressure() {
        return difPressure;
    }

    public void setDifPressure(double difPressure) {
        this.difPressure = difPressure;
    }

    public int getFrontEBS() {
        return frontEBS;
    }

    public void setFrontEBS(int frontEBS) {
        this.frontEBS = frontEBS;
    }

    public int getBackEBS() {
        return backEBS;
    }

    public void setBackEBS(int backEBS) {
        this.backEBS = backEBS;
    }

    public double getFrontLeftHoofStatusEBS() {
        return frontLeftHoofStatusEBS;
    }

    public void setFrontLeftHoofStatusEBS(double frontLeftHoofStatusEBS) {
        this.frontLeftHoofStatusEBS = frontLeftHoofStatusEBS;
    }

    public double getFrontRightHoofStatusEBS() {
        return frontRightHoofStatusEBS;
    }

    public void setFrontRightHoofStatusEBS(double frontRightHoofStatusEBS) {
        this.frontRightHoofStatusEBS = frontRightHoofStatusEBS;
    }

    public double getBack1LeftHoofStatusEBS() {
        return back1LeftHoofStatusEBS;
    }

    public void setBack1LeftHoofStatusEBS(double back1LeftHoofStatusEBS) {
        this.back1LeftHoofStatusEBS = back1LeftHoofStatusEBS;
    }

    public double getBack1RightHoofStatusEBS() {
        return back1RightHoofStatusEBS;
    }

    public void setBack1RightHoofStatusEBS(double back1RightHoofStatusEBS) {
        this.back1RightHoofStatusEBS = back1RightHoofStatusEBS;
    }

    public double getBack2LeftHoofStatusEBS() {
        return back2LeftHoofStatusEBS;
    }

    public void setBack2LeftHoofStatusEBS(double back2LeftHoofStatusEBS) {
        this.back2LeftHoofStatusEBS = back2LeftHoofStatusEBS;
    }

    public double getBack2RightHoofStatusEBS() {
        return back2RightHoofStatusEBS;
    }

    public void setBack2RightHoofStatusEBS(double back2RightHoofStatusEBS) {
        this.back2RightHoofStatusEBS = back2RightHoofStatusEBS;
    }

    public double getBack3LeftHoofStatusEBS() {
        return back3LeftHoofStatusEBS;
    }

    public void setBack3LeftHoofStatusEBS(double back3LeftHoofStatusEBS) {
        this.back3LeftHoofStatusEBS = back3LeftHoofStatusEBS;
    }

    public double getBack3RightHoofStatusEBS() {
        return back3RightHoofStatusEBS;
    }

    public void setBack3RightHoofStatusEBS(double back3RightHoofStatusEBS) {
        this.back3RightHoofStatusEBS = back3RightHoofStatusEBS;
    }

    public int getFrontLeftHoofStatus() {
        return frontLeftHoofStatus;
    }

    public void setFrontLeftHoofStatus(int frontLeftHoofStatus) {
        this.frontLeftHoofStatus = frontLeftHoofStatus;
    }

    public int getFrontRightHoofStatus() {
        return frontRightHoofStatus;
    }

    public void setFrontRightHoofStatus(int frontRightHoofStatus) {
        this.frontRightHoofStatus = frontRightHoofStatus;
    }

    public int getBack1LeftHoofStatus() {
        return back1LeftHoofStatus;
    }

    public void setBack1LeftHoofStatus(int back1LeftHoofStatus) {
        this.back1LeftHoofStatus = back1LeftHoofStatus;
    }

    public int getBack1RightHoofStatus() {
        return back1RightHoofStatus;
    }

    public void setBack1RightHoofStatus(int back1RightHoofStatus) {
        this.back1RightHoofStatus = back1RightHoofStatus;
    }

    public int getBack2LeftHoofStatus() {
        return back2LeftHoofStatus;
    }

    public void setBack2LeftHoofStatus(int back2LeftHoofStatus) {
        this.back2LeftHoofStatus = back2LeftHoofStatus;
    }

    public int getBack2RightHoofStatus() {
        return back2RightHoofStatus;
    }

    public void setBack2RightHoofStatus(int back2RightHoofStatus) {
        this.back2RightHoofStatus = back2RightHoofStatus;
    }

    public int getBack3LeftHoofStatus() {
        return back3LeftHoofStatus;
    }

    public void setBack3LeftHoofStatus(int back3LeftHoofStatus) {
        this.back3LeftHoofStatus = back3LeftHoofStatus;
    }

    public int getBack3RightHoofStatus() {
        return back3RightHoofStatus;
    }

    public void setBack3RightHoofStatus(int back3RightHoofStatus) {
        this.back3RightHoofStatus = back3RightHoofStatus;
    }

    public static MaintenanceEvent2D00BDto parseProto(LCPredictiveMaintenanceD00B.MaintenanceEvent2 maintenanceEvent2){
        MaintenanceEvent2D00BDto maintenanceEvent2Dto = new MaintenanceEvent2D00BDto();
        maintenanceEvent2Dto.setBlockSwitch(maintenanceEvent2.getBlockSwitch());
        maintenanceEvent2Dto.setDifPressure(maintenanceEvent2.getDifPressure());
        maintenanceEvent2Dto.setFrontEBS(maintenanceEvent2.getFrontEBS());
        maintenanceEvent2Dto.setBackEBS(maintenanceEvent2.getBackEBS());
        maintenanceEvent2Dto.setFrontLeftHoofStatusEBS(maintenanceEvent2.getFrontLeftHoofStatusEBS());
        maintenanceEvent2Dto.setFrontRightHoofStatusEBS(maintenanceEvent2.getFrontRightHoofStatusEBS());
        maintenanceEvent2Dto.setBack1LeftHoofStatusEBS(maintenanceEvent2.getBack1LeftHoofStatusEBS());
        maintenanceEvent2Dto.setBack1RightHoofStatusEBS(maintenanceEvent2.getBack1RightHoofStatusEBS());
        maintenanceEvent2Dto.setBack2LeftHoofStatusEBS(maintenanceEvent2.getBack2LeftHoofStatusEBS());
        maintenanceEvent2Dto.setBack2RightHoofStatusEBS(maintenanceEvent2.getBack2RightHoofStatusEBS());
        maintenanceEvent2Dto.setBack3LeftHoofStatusEBS(maintenanceEvent2.getBack3LeftHoofStatusEBS());
        maintenanceEvent2Dto.setBack3RightHoofStatusEBS(maintenanceEvent2.getBack3RightHoofStatusEBS());
        maintenanceEvent2Dto.setFrontLeftHoofStatus(maintenanceEvent2.getFrontLeftHoofStatus());
        maintenanceEvent2Dto.setFrontRightHoofStatus(maintenanceEvent2.getFrontRightHoofStatus());
        maintenanceEvent2Dto.setBack1LeftHoofStatus(maintenanceEvent2.getBack1LeftHoofStatus());
        maintenanceEvent2Dto.setBack1RightHoofStatus(maintenanceEvent2.getBack1RightHoofStatus());
        maintenanceEvent2Dto.setBack2LeftHoofStatus(maintenanceEvent2.getBack2LeftHoofStatus());
        maintenanceEvent2Dto.setBack2RightHoofStatus(maintenanceEvent2.getBack2RightHoofStatus());
        maintenanceEvent2Dto.setBack3LeftHoofStatus(maintenanceEvent2.getBack3LeftHoofStatus());
        maintenanceEvent2Dto.setBack3RightHoofStatus(maintenanceEvent2.getBack3RightHoofStatus());
        return maintenanceEvent2Dto;
    }

    /**
     * 解析成String拼接字符串
     * @param maintenanceEvent2
     * @return
     */
    public static String parseString(LCPredictiveMaintenanceD00B.MaintenanceEvent2 maintenanceEvent2){
        return EntityConvert.convert(
                maintenanceEvent2.getBlockSwitch(),
                maintenanceEvent2.getDifPressure(),
                maintenanceEvent2.getFrontEBS(),
                maintenanceEvent2.getBackEBS(),
                maintenanceEvent2.getFrontLeftHoofStatusEBS(),
                maintenanceEvent2.getFrontRightHoofStatusEBS(),
                maintenanceEvent2.getBack1LeftHoofStatusEBS(),
                maintenanceEvent2.getBack1RightHoofStatusEBS(),
                maintenanceEvent2.getBack2LeftHoofStatusEBS(),
                maintenanceEvent2.getBack2RightHoofStatusEBS(),
                maintenanceEvent2.getBack3LeftHoofStatusEBS(),
                maintenanceEvent2.getBack3RightHoofStatusEBS(),
                maintenanceEvent2.getFrontLeftHoofStatus(),
                maintenanceEvent2.getFrontRightHoofStatus(),
                maintenanceEvent2.getBack1LeftHoofStatus(),
                maintenanceEvent2.getBack1RightHoofStatus(),
                maintenanceEvent2.getBack2LeftHoofStatus(),
                maintenanceEvent2.getBack2RightHoofStatus(),
                maintenanceEvent2.getBack3LeftHoofStatus(),
                maintenanceEvent2.getBack3RightHoofStatus());

    }

    /**
     * 反解析成PB对象
     * @param str
     * @return
     */
    public static LCPredictiveMaintenanceD00B.MaintenanceEvent2 parsePB(String str){
        LCPredictiveMaintenanceD00B.MaintenanceEvent2.Builder builder = null;

        try{
            String[] revert = EntityConvert.revert(str);
            if(null!=revert && revert.length>=20){
                builder =LCPredictiveMaintenanceD00B.MaintenanceEvent2.newBuilder();
                builder.setBlockSwitch(Integer.valueOf(revert[0]));
                builder.setDifPressure(Double.valueOf(revert[1]));
                builder.setFrontEBS(Integer.valueOf(revert[2]));
                builder.setBackEBS(Integer.valueOf(revert[3]));
                builder.setFrontLeftHoofStatusEBS(Double.valueOf(revert[4]));
                builder.setFrontRightHoofStatusEBS(Double.valueOf(revert[5]));
                builder.setBack1LeftHoofStatusEBS(Double.valueOf(revert[6]));
                builder.setBack1RightHoofStatusEBS(Double.valueOf(revert[7]));
                builder.setBack2LeftHoofStatusEBS(Double.valueOf(revert[8]));
                builder.setBack2RightHoofStatusEBS(Double.valueOf(revert[9]));
                builder.setBack3LeftHoofStatusEBS(Double.valueOf(revert[10]));
                builder.setBack3RightHoofStatusEBS(Double.valueOf(revert[11]));
                builder.setFrontLeftHoofStatus(Integer.valueOf(revert[12]));
                builder.setFrontRightHoofStatus(Integer.valueOf(revert[13]));
                builder.setBack1LeftHoofStatus(Integer.valueOf(revert[14]));
                builder.setBack1RightHoofStatus(Integer.valueOf(revert[15]));
                builder.setBack2LeftHoofStatus(Integer.valueOf(revert[16]));
                builder.setBack2RightHoofStatus(Integer.valueOf(revert[17]));
                builder.setBack3LeftHoofStatus(Integer.valueOf(revert[18]));
                builder.setBack3RightHoofStatus(Integer.valueOf(revert[19]));
            }
        }catch (Exception e){
            e.printStackTrace();
        }

        return builder==null? null : builder.build();
    }

}
